//
//  HotPlaceCollectionViewCell.m
//  Travel_M_Travel
//
//  Created by APPLE10 on 15-4-6.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "HotPlaceCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation HotPlaceCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.hotPlaceImageView  =  [[UIImageView alloc]init];
        
        //        _hotPlaceImageView.backgroundColor = [UIColor cyanColor];
        _hotPlaceImageView.layer.cornerRadius = 10;
        _hotPlaceImageView.clipsToBounds = YES;
        [self.contentView addSubview:_hotPlaceImageView];
        
        [_hotPlaceImageView release];
        
        self.nameLable = [[UILabel alloc]init];
        //        _nameLable.backgroundColor = [UIColor blackColor];
        //        _nameLable.alpha = 0.5;
        _nameLable.highlighted = YES;
        _nameLable.textColor = [UIColor whiteColor];
        [self.contentView addSubview: _nameLable];
        
        
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.hotPlaceImageView.frame = self.contentView.bounds;
    self.nameLable.frame = CGRectMake(0, self.contentView.frame.size.height *4/ 5, self.contentView.frame.size.width, 20);
}

- (void)setHotData:(HotPlaceDataSource *)hotData
{
    if (_hotData != hotData) {
        [_hotData release];
        _hotData = [hotData retain];
    }
    NSString *str = _hotData.cover_s;
    
    [self.hotPlaceImageView setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"jiazai1.png"]];
    self.nameLable.text = hotData.name;
}

@end
